#{extends 'main.html'/}
#{set 'moreScripts'}
<script src="https://unpkg.com/lodash@4.17.4/lodash.min.js"></script>
<script src="https://cdn.bootcss.com/element-ui/1.3.7/index.js"></script>
<script src="/tts/public/js/common/json-submit.js"></script>
<script src="/tts/public/js/batch/batchs.js"></script>
#{/set}
#{set 'moreCss'}
<link rel="stylesheet" href="https://cdn.bootcss.com/element-ui/1.3.7/theme-default/index.css">
<link rel="stylesheet" href="/tts/public/css/admin/tutor-index.css">

<style>
    input[type=file] {
         display: none;
    }
</style>
#{/set}
<div id="app">
    #{navbar /}
    <div class="container">
        <!-- Page Heading/Breadcrumbs -->
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">导师信息批量维护</h1>
            </div>
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-md-12">
                <hr>
                <div class="row">
                    <div class="col-md-12">
                        <div id="btnContent">
                            <div>
                                <p>
                                    <el-button type="primary" @click="batchFormVisible=true">添加批次 <i class="el-icon-plus"></i></el-button>
                                    <el-button type="primary" @click="getTemplate()">下载模板 <i class="el-icon-plus"></i></el-button>
                                    <el-button type="info" @click="tutorStat()">导师报表 <i class="el-icon-plus"></i></el-button>
                                </p>
                            </div>
                        </div>

                        <div id="batchContent">
                            <el-table
                                    :data="batchs"
                                    stripe
                                    style="width: 100%">
                                <el-table-column
                                        prop="batchyear"
                                        label="年份"
                                        width="180">
                                </el-table-column>
                                <el-table-column
                                        prop="isOpen"
                                        label="是否开放"
                                        width="180"
                                        :formatter="openformatter"
                                >
                                </el-table-column>
                                <el-table-column
                                        prop="createUser"
                                        label="操作员">
                                </el-table-column>
                                <el-table-column fixed="right" label="操作"  width="400">
                                    <template scope="scope">
                                            <el-button size="small" @click="show(scope.row.id)">查看明细</el-button>
                                            <el-button size="small" @click="toggle(scope.row)">切换可见状态</el-button>
                                            <el-upload
                                                    class="upload-demo"
                                                    action="/tts/batch/upload"
                                                    :show-file-list="false"
                                                    :data="{id:scope.row.id}">
                                                <el-button size="small" type="primary">导入名单</el-button>
                                            </el-upload>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>

                        <div style="padding:20px"></div>

                        <div id="detailContent">
                            <el-table
                                    :data="lists"
                                    stripe
                                    style="width: 100%">
                                <el-table-column
                                        prop="code"
                                        label="工号"
                                        width="115">
                                </el-table-column>
                                <el-table-column
                                        prop="name"
                                        label="姓名"
                                        width="115">
                                </el-table-column>
                                <el-table-column
                                        prop="unit"
                                        label="部门"
                                        width="165">
                                </el-table-column>
                                <el-table-column
                                        prop="tutorType"
                                        label="导师类型"
                                        width="110">
                                </el-table-column>
                                <el-table-column
                                        prop="direction"
                                        label="学科"
                                        width="160">
                                </el-table-column>
                                <el-table-column
                                        prop="isParttime"
                                        label="是否兼职"
                                        width="80"
                                        :formatter="parttimeformatter">
                                </el-table-column>
                                <el-table-column fixed="right" label="操作"  width="400">
                                    <template scope="scope">
                                        <el-button size="small" @click="handleEditList(scope.row)">编辑记录</el-button>
                                        <el-button size="small" @click="handleEditTutor(scope.row.code)">编辑导师</el-button>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>

                    </div>
                </div>

                <div>
                    <el-dialog title="添加批次" :visible.sync="batchFormVisible">
                        <el-form :model="batchForm">
                            <el-form-item label="年份" prop="batchyear" :label-width="formLabelWidth">
                                <el-input v-model="batchForm.batchyear" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-form>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="batchFormVisible=false">取 消</el-button>
                            <el-button type="primary" @click="addBatch(batchForm.batchyear)">提 交</el-button>
                        </div>
                    </el-dialog>
                </div>

                <div>
                    <el-dialog title="编辑记录" :visible.sync="listFormVisible">
                        <el-form :model="listForm">
                            <el-form-item label="工号" prop="code" :label-width="formLabelWidth">
                                <el-input v-model="listForm.code" :disabled="true"></el-input>
                            </el-form-item>
                            <el-form-item label="姓名" prop="name" :label-width="formLabelWidth">
                                <el-input v-model="listForm.name" auto-complete="off"></el-input>
                            </el-form-item>
                            <el-form-item label="部门" prop="unit" :label-width="formLabelWidth">
                                <el-input v-model="listForm.unit" auto-complete="off"></el-input>
                            </el-form-item>
                            <el-form-item label="导师类型" prop="tutorType" :label-width="formLabelWidth">
                                <el-input v-model="listForm.tutorType" auto-complete="off"></el-input>
                            </el-form-item>
                            <el-form-item label="学科" prop="direction" :label-width="formLabelWidth">
                                <el-input v-model="listForm.direction" auto-complete="off"></el-input>
                            </el-form-item>
                            <el-form-item label="是否兼职" prop="isParttime" :label-width="formLabelWidth">
                                <el-radio-group v-model="listForm.isParttime">
                                    <el-radio :label="false">全职</el-radio>
                                    <el-radio :label="true">兼职</el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-form>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="listFormVisible=false">取 消</el-button>
                            <el-button type="primary" @click="editList()">提 交</el-button>
                        </div>
                    </el-dialog>
                </div>

                <hr>
            </div>



            <hr>
        </div>
    </div>
</div>

